package com.xywl.escort.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xywl.escort.R;
import com.xywl.escort.bean.BandCardListResp;
import com.xywl.escort.widget.GlideApp;

import java.util.List;

/**
 * Created by 32422 on 2018/5/10.
 */

public class BandCardListAdapter extends BaseQuickAdapter<BandCardListResp.DataBean.ListBean, BaseViewHolder> {
    public BandCardListAdapter(int layoutResId, @Nullable List<BandCardListResp.DataBean.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, BandCardListResp.DataBean.ListBean item) {
        ImageView imageBand = helper.getView(R.id.image_band);
        GlideApp.with(mContext)
                .load(item.mobileBankIco)
                .centerCrop()
                .placeholder(R.mipmap.icon_default_picture)
                .into(imageBand);

        helper.setText(R.id.text_band_name, item.bankName);
        helper.setText(R.id.text_card_type, "借记卡");
        String bankCardNo = item.bankCardNo;
        String bandCardNo = "**** **** **** ";
        if (bankCardNo.length() > 4) {
            bandCardNo = bandCardNo + bankCardNo.substring(bankCardNo.length() - 4, bankCardNo.length());
        } else {
            bandCardNo = bandCardNo + bankCardNo;
        }
        helper.setText(R.id.text_card_no, bandCardNo);
    }
}
